﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using NDF.Data.EntityFramework;
using NDF.Utilities;
using System;
using System.Data.Entity;
using System.Linq;
using UA.Data;
using UA.Data.Model;

namespace UAServices.Tests.EntityFramework
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {
            using (UADbContext ctx = new UADbContext())
            {
                //UserAccessor accessor = new UserAccessor();
                //var data = accessor.QueryPage(1, 2);
                //Console.WriteLine(data.ToJson());
                var data = ctx.Users.OrderBy(u => u.ID).ToArray().ToPagingData(0, 2);
                Console.WriteLine(data.ToJson());
            }
        }


        [TestMethod]
        public void InitializeUADemoDb()
        {
            using (UADbContext ctx = new UADbContext())
            {
                UADemoDbMigrationConfiguration.ClearData(ctx);
                UADemoDbMigrationConfiguration.InitializeData(ctx);
                ctx.SaveChanges(false);
            }
        }
    }
}
